package com.buddy.learn.javasource._lock;

import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
 * @author Buddy
 * @date 2021/5/19
 */
public class _ReadWriteLock {

    public static void main(String[] args) {
        // 如何标记读锁还是写锁的呢？
        // state int 类型 32位，高16位代表读锁，低16位代表写锁。
        ReadWriteLock readWriteLock = new ReentrantReadWriteLock(true);
        readWriteLock.readLock().lock();
        readWriteLock.writeLock().lock();
    }
}
